#ifndef		CObject_h
#define		CObject_h

#include	"Config.h"
#include	<string>
#include	<vector>

struct CColor
{
	float r, g, b, a;
};
struct CMaterial
{
	float shininess;
	CColor diffuse;
	CColor ambient;
	CColor specular;
	CColor emission;
	std::string texture;
};
struct CPoint
{
	float x, y, z, u, v;
};
struct CTriangle
{
	CPoint p1, p2, p3;
	unsigned int mat;
};
class CObject
{
public:
	CObject(Config & config, const std::string & name);
	~CObject();
	void Cleanup();
	void AddMaterial(const CMaterial & material);
	void AddTriangle(const CTriangle & triangle);
	void SortTriangles();
	void Save(const std::string & file) const;
private:
	void WriteHeader(std::ostream & stream) const;
	void WriteMaterials(std::ostream & stream) const;
	void WriteTriangles(std::ostream & stream) const;
private:
	Config * m_config;
	std::string m_name;
	std::vector< CMaterial > m_material;
	std::vector< CTriangle > m_triangle;
};

#endif	//	CObject_h

